package sample.chapter6.patterMatching;

import java.io.Console;
import java.util.Scanner;

public class ScanNext 
{
	public static void main(String[] args)
	{
		String hits = " ";
		boolean b;
		Console c = System.console();
		String str = c.readLine("%s", "Input: ");
		
		Scanner s1 = new Scanner(str);
		Scanner s2 = new Scanner(str);
		
		while(b = s1.hasNext())
		{
			s1.next();
			hits+="s";
//			System.out.println(hits);
		}
		
		hits+="|";
		
		while(b = s2.hasNext())
		{
			if(s2.hasNextInt())
			{
				s2.nextInt();
				hits+="i";
			}
			else if(s2.hasNextBoolean())
			{
				s2.nextBoolean();
				hits+="b";
			}
			else
			{
				s2.next();
				hits+="s2";
			}
//			System.out.println(hits);
		}
		System.out.println("hits "+hits);
	}
}
